From 58ec54a40486cd4ab140406903a3f3832adf26e0 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 27 Dec 2010 21:34:00 +0100 Subject: [PATCH] Add BABL_IS_BEING_COMPILED #define support Sometimes it is ok that babl includes are included directly and not through babl.h, like when we generate GObject introspection files. The important thing is just that users of the babl API don't begin to include headers we don't guarantee to always exist, and BABL_IS_BEING_COMPILED doesn't obstruct this goal. --- babl/Makefile.am | 1 + babl/babl-macros.h | 2 +- babl/babl-types.h | 2 +- babl/babl-version.h.in | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/babl/Makefile.am b/babl/Makefile.am index 979afb5..1823265 100644 --- a/babl/Makefile.am +++ b/babl/Makefile.am @@ -96,6 +96,7 @@ Babl-$(BABL_API_VERSION).gir: $(G_IR_SCANNER) $(library_include_HEADERS) $(c_sou --libtool="$(LIBTOOL)" \ --output $@ \ --pkg babl \ + -DBABL_IS_BEING_COMPILED \ -I$(top_srcdir) \ -I$(top_builddir) \ $(library_include_HEADERS) \ diff --git a/babl/babl-macros.h b/babl/babl-macros.h index 8de6864..f022d9f 100644 --- a/babl/babl-macros.h +++ b/babl/babl-macros.h @@ -19,7 +19,7 @@ #ifndef _BABL_MACROS_H #define _BABL_MACROS_H -#ifndef BABL_INSIDE_BABL_H +#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED) #error "babl-version.h must not be included directly, include babl.h instead." #endif diff --git a/babl/babl-types.h b/babl/babl-types.h index d1deae7..162e6c9 100644 --- a/babl/babl-types.h +++ b/babl/babl-types.h @@ -19,7 +19,7 @@ #ifndef _BABL_TYPES_H #define _BABL_TYPES_H -#ifndef BABL_INSIDE_BABL_H +#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED) #error "babl-version.h must not be included directly, include babl.h instead." #endif diff --git a/babl/babl-version.h.in b/babl/babl-version.h.in index 9789099..ab00824 100644 --- a/babl/babl-version.h.in +++ b/babl/babl-version.h.in @@ -19,7 +19,7 @@ #ifndef _BABL_VERSION_H #define _BABL_VERSION_H -#ifndef BABL_INSIDE_BABL_H +#if !defined(BABL_INSIDE_BABL_H) && !defined(BABL_IS_BEING_COMPILED) #error "babl-version.h must not be included directly, include babl.h instead." #endif -- 2.30.2